<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<?php
	session_start();
	$username = $_POST["username"]; 
	$password = $_POST["password"];

	mysql_connect("localhost", "root", "kabra");
	mysql_select_db("db2") or die('Could not select database');

	$sql="SELECT * FROM users WHERE username='$username' AND password='$password'";
//	$sql1="SELECT name FROM users2 WHERE username='$username' AND password='$password'";
	
	$result=mysql_query($sql);

	$count=mysql_num_rows($result);

	if($count==1)
	{
		$_SESSION["username"] = $username; 
		$_SESSION["loggedIn"] = true; 
		header("Location:authenticated.php");
	}else{ 
		header("Location:login.php");
	}
?>
<body>
</body>
</html>